package com.example.design.shejimoshi.createMode.factoryMode.抽象工厂模式.factory;


import com.example.design.shejimoshi.createMode.factoryMode.抽象工厂模式.Color;
import com.example.design.shejimoshi.createMode.factoryMode.抽象工厂模式.Green;
import com.example.design.shejimoshi.createMode.factoryMode.抽象工厂模式.Red;
import com.example.design.shejimoshi.createMode.factoryMode.抽象工厂模式.Shape;
import com.example.design.shejimoshi.createMode.factoryMode.抽象工厂模式.factory.AbstractFactory;

/**
 * 专门生产Color对象的工厂
 */
public class ColorFactory extends AbstractFactory {
    
   @Override
   public Shape getShape(String shapeType){
      return null;
   }
   
   @Override
   public Color getColor(String color) {
      if(color == null){
         return null;
      }        
      if(color.equalsIgnoreCase("RED")){
         return new Red();
      } else if(color.equalsIgnoreCase("GREEN")){
         return new Green();
      }
      return null;
   }
}